<?php

/**
 * Contrato filter form base class.
 *
 * @package    saveenergy
 * @subpackage filter
 * @author     0
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseContratoFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'referencia'       => new sfWidgetFormFilterInput(),
      'tipo'             => new sfWidgetFormFilterInput(),
      'titular'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'cliente_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cliente'), 'add_empty' => true)),
      'compania_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Compania'), 'add_empty' => true)),
      'companiaAnterior' => new sfWidgetFormFilterInput(),
      'comercial_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Comercial'), 'add_empty' => true)),
      'energia_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Energia'), 'add_empty' => true)),
      'tarifa_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Tarifa'), 'add_empty' => true)),
      'tarifaFirmada'    => new sfWidgetFormFilterInput(),
      'consumoAnual'     => new sfWidgetFormFilterInput(),
      'numeroCuenta'     => new sfWidgetFormFilterInput(),
      'estado'           => new sfWidgetFormFilterInput(),
      'producto'         => new sfWidgetFormFilterInput(),
      'ruta'             => new sfWidgetFormFilterInput(),
      'is_firmado'       => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_enviado'       => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_recibido'      => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_tramitado'     => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'fechaFirma'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'fechaRecibida'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'fechaEnvio'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'fechaTramitacion' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'is_incidencia'    => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'incidencia'       => new sfWidgetFormFilterInput(),
      'fechaVencimiento' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'fechaDelegado'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'contacto'         => new sfWidgetFormFilterInput(),
      'fechaRevision'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'created_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'referencia'       => new sfValidatorPass(array('required' => false)),
      'tipo'             => new sfValidatorPass(array('required' => false)),
      'titular'          => new sfValidatorPass(array('required' => false)),
      'cliente_id'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Cliente'), 'column' => 'id')),
      'compania_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Compania'), 'column' => 'id')),
      'companiaAnterior' => new sfValidatorPass(array('required' => false)),
      'comercial_id'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Comercial'), 'column' => 'id')),
      'energia_id'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Energia'), 'column' => 'id')),
      'tarifa_id'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Tarifa'), 'column' => 'id')),
      'tarifaFirmada'    => new sfValidatorPass(array('required' => false)),
      'consumoAnual'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'numeroCuenta'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'estado'           => new sfValidatorPass(array('required' => false)),
      'producto'         => new sfValidatorPass(array('required' => false)),
      'ruta'             => new sfValidatorPass(array('required' => false)),
      'is_firmado'       => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_enviado'       => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_recibido'      => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_tramitado'     => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'fechaFirma'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'fechaRecibida'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'fechaEnvio'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'fechaTramitacion' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'is_incidencia'    => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'incidencia'       => new sfValidatorPass(array('required' => false)),
      'fechaVencimiento' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'fechaDelegado'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'contacto'         => new sfValidatorPass(array('required' => false)),
      'fechaRevision'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'created_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('contrato_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Contrato';
  }

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'referencia'       => 'Text',
      'tipo'             => 'Text',
      'titular'          => 'Text',
      'cliente_id'       => 'ForeignKey',
      'compania_id'      => 'ForeignKey',
      'companiaAnterior' => 'Text',
      'comercial_id'     => 'ForeignKey',
      'energia_id'       => 'ForeignKey',
      'tarifa_id'        => 'ForeignKey',
      'tarifaFirmada'    => 'Text',
      'consumoAnual'     => 'Number',
      'numeroCuenta'     => 'Number',
      'estado'           => 'Text',
      'producto'         => 'Text',
      'ruta'             => 'Text',
      'is_firmado'       => 'Boolean',
      'is_enviado'       => 'Boolean',
      'is_recibido'      => 'Boolean',
      'is_tramitado'     => 'Boolean',
      'fechaFirma'       => 'Date',
      'fechaRecibida'    => 'Date',
      'fechaEnvio'       => 'Date',
      'fechaTramitacion' => 'Date',
      'is_incidencia'    => 'Boolean',
      'incidencia'       => 'Text',
      'fechaVencimiento' => 'Date',
      'fechaDelegado'    => 'Date',
      'contacto'         => 'Text',
      'fechaRevision'    => 'Date',
      'created_at'       => 'Date',
      'updated_at'       => 'Date',
    );
  }
}
